/*
 * EDAS2 - TetraTech, Inc.
 *
 * Distributable under GPL license.
 * See terms of license at gnu.org.
 */
package com.tetratech.edas2.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * Citation generated by hbm2java
 */
@Entity
@Table(name = "ED_CITATION")
public class Citation extends AttributableUpdateRetireEntity
		implements
			java.io.Serializable {

	private Long uid;
	private Organization organization;
	private String id;
	private String creator;
	private Date date;
	private String publisher;
	private String subject;
	private String title;
	private String description;
	private Set<Lifestyle> lifestyles = new HashSet<Lifestyle>(0);

	public Citation() {
	}

	public Citation(Long uid, Organization organization, String id, Date date,
			String title) {
		this.uid = uid;
		this.organization = organization;
		this.id = id;
		this.date = date;
		this.title = title;
	}

	@Id
	@Column(name = "CITATN_UID", unique = true, nullable = false, precision = 6, scale = 0)
	@GeneratedValue(generator = "CitationSequence")
	@SequenceGenerator(name = "CitationSequence", sequenceName = "CITATN_SEQ", allocationSize = 1)
	@NotNull
	public Long getUid() {
		return this.uid;
	}

	public void setUid(Long uid) {
		this.uid = uid;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ORG_UID", nullable = false)
	@NotNull
	public Organization getOrganization() {
		return this.organization;
	}

	public void setOrganization(Organization organization) {
		this.organization = organization;
	}

	@Column(name = "CITATN_ID", nullable = false)
	@NotNull
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "CITATN_CREATOR", length = 120)
	@Length(max = 120)
	public String getCreator() {
		return this.creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}
	@Temporal(TemporalType.DATE)
	@Column(name = "CITATN_DATE", nullable = false, length = 7)
	@NotNull
	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@Column(name = "CITATN_PUBLISHER", length = 60)
	@Length(max = 60)
	public String getPublisher() {
		return this.publisher;
	}

	public void setPublisher(String publisher) {
		this.publisher = publisher;
	}

	@Column(name = "CITATN_SUBJECT", length = 500)
	@Length(max = 500)
	public String getSubject() {
		return this.subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	@Column(name = "CITATN_TITLE", nullable = false, length = 120)
	@NotNull
	@Length(max = 120)
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "CITATN_DESCR", length = 300)
	@Length(max = 300)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "citation")
	public Set<Lifestyle> getLifestyles() {
		return this.lifestyles;
	}

	public void setLifestyles(Set<Lifestyle> lifestyles) {
		this.lifestyles = lifestyles;
	}

}
